

created:function login(index){
    var login = document.getElementsByClassName("form_input");

    var register_Title= document.getElementsByClassName("register");
    var login_Title = document.getElementsByClassName("login");
    if(index == 1){
        login_Title[0].style.color = "#fff";
        register_Title[0].style.color = "#838383";
        login[0].style.display = "block";
        login[1].style.display = "none";
    }else if (index == 2){
        login_Title[0].style.color = "#838383";
        register_Title[0].style.color = "#fff";
        login[0].style.display = "none";
        login[1].style.display = "block";
    }
}

$(function () {
    var input_New_Password = $(".js_New_password");
    var text_New_Password = $(".placeholder_New_password");
    $(document).ready(function () {
        //获得
        input_New_Password.click(function () {
            text_New_Password.css({"transform": "translate3d(0px,-12px,500px)", "font-size": "14px"})
        });
        //失去
        input_New_Password.blur(function () {
            var password_Value = $(".js_New_password").val();
            if (password_Value.trim() == null || password_Value.trim() == ""){
                text_New_Password.css("color","#f04645");

                var hint_text = "请输入密码";
                var hint_password = $(".hint_New_password");
                hint_password.text(hint_text);

                text_New_Password.css({"transform": "translate3d(0px,0px,500px)", "font-size": "20px"})
            }else if (password_Value.trim() != null || password_Value.trim() != ""){
                text_New_Password.css("color","#5E5E5E")

                var hint_password = $(".hint_New_password");
                hint_password.text("");

            }
        });
    });

    var mail_text = $(".placeholder_Mail");
    var mail_Input = $(".js_mail");
    $(document).ready(function () {
        //获得
        mail_Input.click(function () {
            mail_text.css({"transform": "translate3d(0px,-12px,500px)", "font-size": "14px"})
        });

        //失去
        mail_Input.blur(function () {
            //值
            var mail_Value = mail_Input.val();
            if (mail_Value.trim() == null || mail_Value.trim() == ""){
                mail_text.css("color","#f04645");

                var hint_text = "请输入QQ邮箱";
                var hint_mail = $(".hint_mail");
                hint_mail.text(hint_text);

                mail_text.css({"transform": "translate3d(0px,0px,500px)", "font-size": "20px"});
            }else if (mail_Value.trim() != null || mail_Value.trim() != ""){
                var hint_mail = $(".hint_mail");
                hint_mail.text("");

                mail_text.css("color","#5E5E5E")
            }
        });
    });

    var placeholder_text = $(".placeholder_Verification");
    var placeholder_Input = $(".placeholder_Input");
    $(document).ready(function () {
        //获得
        placeholder_Input.click(function () {
            placeholder_text.css({"transform": "translate3d(0px,-12px,500px)", "font-size": "14px"})
        });

        //失去
        placeholder_Input.blur(function () {
            //值
            var hint_Placeholder_Value = $(".placeholder_Input").val();
            if (hint_Placeholder_Value.trim() == null || hint_Placeholder_Value.trim() == ""){
                placeholder_text.css("color","#f04645");

                var hint_text = "请输入验证码";
                var hint_Placeholder = $(".hint_Placeholder");
                hint_Placeholder.text(hint_text);

                placeholder_text.css({"transform": "translate3d(0px,0px,500px)", "font-size": "20px"});
            }else if (hint_Placeholder_Value.trim() != null || hint_Placeholder_Value.trim() != ""){
                console.log(1)
                var hint_Id = $(".hint_Placeholder");
                hint_Id.text("");

                placeholder_text.css("color","#5E5E5E")
            }
        });
    });



    var input_Id = $(".js_id");
    var text_Id = $(".placeholder_id");
    $(document).ready(function () {
        //获得
        input_Id.click(function () {
            text_Id.css({"transform": "translate3d(0px,-12px,500px)", "font-size": "14px"})
        });

        //失去
        input_Id.blur(function () {
            //值
            var id_Value = $(".js_id").val();
            if (id_Value.trim() == null || id_Value.trim() == ""){
                text_Id.css("color","#f04645");

                var hint_text = "请输入账号";
                var hint_Id = $(".hint_Id");
                hint_Id.text(hint_text);

                text_Id.css({"transform": "translate3d(0px,0px,500px)", "font-size": "20px"});
            }else if (id_Value.trim() != null || id_Value.trim() != "" ){

                var hint_Id = $(".hint_Id");
                hint_Id.text("");

                text_Id.css("color","#5E5E5E")
            }
        });
    });

    var input_Password = $(".js_password");
    var text_Password = $(".placeholder_password");
    $(document).ready(function () {
        //获得
        input_Password.click(function () {
            text_Password.css({"transform": "translate3d(0px,-12px,500px)", "font-size": "14px"})
        });
        //失去
        input_Password.blur(function () {
            var password_Value = $(".js_password").val();
            if (password_Value.trim() == null || password_Value.trim() == ""){
                text_Password.css("color","#f04645");

                var hint_text = "请输入密码";
                var hint_password = $(".hint_password");
                hint_password.text(hint_text);

                text_Password.css({"transform": "translate3d(0px,0px,500px)", "font-size": "20px"})
            }else if (password_Value.trim() != null || password_Value.trim() != ""){
                text_Password.css("color","#5E5E5E")

                var hint_password = $(".hint_password");
                hint_password.text("");

            }
        });
    });
    var code = 0;
    $(".obtain").click(function () {
        var java_Text_mail = $(".js_mail").val()
        $.ajax({
            //请求
            type:"GET",
            //地址
            url:"/mailbox",
            //传值
            data: "java_Text_mail="+java_Text_mail,
            success:function (res) {
                code = res
                console.log(res)
            },
            beforeSend:function () {
                if (!isEmail(java_Text_mail)){
                    var hint_New_mail2 = $(".hint_New_mail2")
                    hint_New_mail2.html("请输入正确的QQ邮箱")
                    return false;
                }
            }
        })
    });
    function isEmail(str) {
        return /[0-9a-zA-Z]+@qq.com/.test(str);
    }
    $(".register_Button").click(function () {
        var java_Text_mail = $(".js_mail").val()
        var placeholder_Input = $(".placeholder_Input").val()
        var js_New_password = $(".js_New_password").val()
        var register_Input = $(".register_Input").prop('checked')
        var arr =[java_Text_mail,placeholder_Input,js_New_password,register_Input]
        $.ajax({
            //请求
            type:"POST",
            //地址
            url:"/login",
            //传值
            data: "arr="+arr,
            success:function (res) {
                $(".body").html(res)
            },
            beforeSend:function () {
                var number_Input = parseInt(placeholder_Input)
                var number_Code = parseInt(code)
                var patt = /[0-9a-zA-z]{8,18}/;
                if (java_Text_mail.trim() == ""){
                    var hint_mail = $(".hint_mail")
                    hint_mail.html("请输入QQ邮箱")
                    return false;
                }else if (placeholder_Input.trim() == ""){
                    var hint_Placeholder = $(".hint_Placeholder")
                    hint_Placeholder.html("请输入验证码")
                    return false;
                }else if (js_New_password.trim() == ""){
                    var hint_New_password = $(".hint_New_password")
                    hint_New_password.html("请输入密码")
                    return false;
                }else if (register_Input == false){
                    var hint_New_protocol = $(".hint_New_protocol")
                    hint_New_protocol.html("请勾选 用户协议 和 隐私政策 协议")
                    return false;
                }else if(number_Input != number_Code){
                    var hint_Placeholder2 = $(".hint_Placeholder2")
                    hint_Placeholder2.html("请输入正确的验证码")
                    return false;
                }else if (js_New_password.trim().length < 8 && js_New_password.trim().length > 18){
                    var hint_New_protocol = $(".hint_New_protocol")
                    hint_New_protocol.html("请输入8-18以内的密码")
                    return false;
                } else if (!patt.test(js_New_password)){
                    var hint_New_password2 = $(".hint_New_password2")
                    hint_New_password2.html("密码需要包含 数字 字母(大小写) 不包括其他符号")
                    return false;
                }
            }
        })
    });


    $(".login_Button").click(function () {
        var js_id = $(".js_id").val()
        var js_password = $(".js_password").val()
        var protocol_Input = $(".protocol_Input").prop('checked')
        var arr =[js_id,js_password]
        $.ajax({
            //请求
            type:"GET",
            //地址
            url:"/gohome",
            //传值
            data: "arr="+arr,
            success:function (res) {
                if (res.trim() == "账号或者密码错误!"){
                    $(".failed_Login").html(res)
                }else{
                    location.href = "/Front/page?id="+res;
                }
            },
            beforeSend:function () {
                if (!protocol_Input){
                    $(".check").html("请勾选 用户协议 和 隐私政策 协议")
                    return false;
                }else if (js_id.trim() == "" ){
                    $(".hint_Id").html("请输入账号")
                    return false;
                }else if(js_password.trim() == ""){
                    $(".hint_password").html("请输入账号")
                    return false;
                }
            }
        })
    });
})